package com.shicijiaoliu.mapper;

import com.shicijiaoliu.pojo.Shicitabel;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface Shicimapper {

    int getCount(String title,String dynasty,String subject,String author);

    @Select("select * from shicitabel where paragraphs = #{paragraphs}")
    Shicitabel findByparagraphs(String paragraphs);

    @Insert("insert into shicitabel(author, title, paragraphs, subject, author_ID, dynasty)" +
            " value (#{author},#{title},#{paragraphs},#{subject},#{authorId},#{dynasty})"
    )
    void useraddshici(Shicitabel shici);

    @Update("update shicitabel set author=#{author},title=#{title},paragraphs=#{paragraphs},subject=#{subject},author_ID=#{authorId},dynasty=#{dynasty} where ID_s=#{idS}")
    void updateshici(Shicitabel shici);

    @Delete("delete from shicitabel where ID_s=#{idS}")
    void delByid(long idS);

    @Select("select * from shicitabel where title=#{title}")
    Shicitabel findBytitle(String title);




  //  @Select("select * from shicitabel limit #{pagecount},#{pagenumber}")
    List<Shicitabel> findshiciBypage(String title,String dynasty,String subject,String author);

    @Select("select * from shicitabel where ID_s=#{idS}")
    Shicitabel findByid(long idS);

    @Select("select * from shicitabel where title like #{title} ")
    List<Shicitabel> findBytitle2(String title);

    @Select("select * from shicitabel where author like #{title} ")
    List<Shicitabel> findByname2(String title);

    @Select("select * from shicitabel where paragraphs like #{title} ")
    List<Shicitabel> findBycontent2(String title);
}
